﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new LoginForm());
            //Application.Run(new Form2());
            Application.Run(new Form22());
            IPAddress[] addresses = Dns.GetHostByName(Dns.GetHostName()).AddressList;
            /**
             * GetHostName:获取本机主机名
             * GetHostByName:获取指定dns主机名主机信息
             * GetHostByAddress:通过ip地址获取指定主机名的主机信息
             * Resole:接收主机格式或ip地址格式的任意中地址格式,返回iphostEntry对象的dns信息
             */
            foreach (IPAddress address in addresses)
            {
                Console.WriteLine("localhost ipadress:"+address.ToString());
            }
            Console.WriteLine("localhost name:" + Dns.GetHostEntry(addresses[0]).HostName);
            IPAddress localip = IPAddress.Parse("127.0.0.1");
            IPEndPoint iep=new IPEndPoint(localip, 80);
            Console.WriteLine("ip端点:"+iep.ToString());
            Console.WriteLine("ip端口:" + iep.Port);
            Console.WriteLine("ip地址族:" + iep.AddressFamily);
            Console.WriteLine("可分配端口最大值:" + IPEndPoint.MaxPort);
            Console.WriteLine("可分配端口最小值:" + IPEndPoint.MinPort);
            Console.ReadLine();
        }
    }
}
